//编写一个函数判断某数是否为素数

#include <stdio.h>
#include <math.h>

int isprime(int n)
{
	int i,lemp=1;
	if (n<=1)
		lemp = 0;
	for (i=2;i<=sqrt(n);i++)
		if (n%i==0)
		{
			lemp = 0;
			break;
		}
	return (lemp);
}

int main()
{
	int n;
	printf("input a number: ");
	scanf("%d",&n);
	if (isprime(n))
		printf("%d is a prime .\n",n);
	else 
		printf("%d is not a prime .\n",n);

	return 0 ;
}

